package com.zzb.util;

import java.io.InputStream;
import java.util.Properties;

public class ReadPropertiesUtil {
	private Properties p = null;

	public ReadPropertiesUtil(String fileName) {
		InputStream is = null;
		try {
			p = new Properties();
			is = this.getClass().getClassLoader().getResourceAsStream(fileName);
			p.load(is);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (is != null) {
					is.close();
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	/**
	 * 读取资源文件
	 * 
	 * @param fileName
	 * @return
	 */
	public String getProperties(String key) {
		return p.getProperty(key);
	}
	/**
	 * 读取资源文件
	 * 
	 * @param fileName
	 * @return
	 */
	public boolean containsKey(String key) {
		return p.containsKey(key);
	}
}
